package cn.tedu.charging.cost.controller;

import cn.tedu.charging.common.pojo.JsonResult;
import cn.tedu.charging.common.pojo.param.ProgressCostParam;
import cn.tedu.charging.common.pojo.vo.ProgressCostVO;
import cn.tedu.charging.cost.service.CostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class CostController {
    //没有业务层
    @Autowired
    private CostService costService;
    @PostMapping("/cost/bill/calculate")
    public JsonResult<ProgressCostVO> calculateBill(
            @RequestBody ProgressCostParam param){
        //orderNo=123 userId=24 pileId=1 gunId=1 totalCapacity=10 第一次充电
        //orderNo=123 userId=24 pileId=1 gunId=1 totalCapacity=20 第二次充电
        ProgressCostVO vo = costService.calculateBill(param);
        return JsonResult.ok(vo);
    }
}
